﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Data.SqlClient;
using System.Text.RegularExpressions;

namespace Framework_Tool
{
    /// <summary>
    /// Interaction logic for TakeAssessment.xaml
    /// </summary>
    public partial class TakeAssessment : Page
    {
        AssessmentView asmntView;
        MainWindow main;

        public string aID = "";

        public TakeAssessment(MainWindow main)
        {
            InitializeComponent();
            this.main = main;
        }

        private void AsmntProfileBtn_Click_1(object sender, RoutedEventArgs e)
        {
            LearnerAssessmentProfile lrnerAsmntProfile = new LearnerAssessmentProfile();
            lrnerAsmntProfile.Content = null;
            mainContent.Children.Add(lrnerAsmntProfile.mainContent);
        }

        private void searchAsmntBtn_Click_1(object sender, RoutedEventArgs e)
        {

        }

        private void mainContent_Loaded_1(object sender, RoutedEventArgs e)
        {
            Database.populateAsmntListview(this);
        }

        private void takeAsmnt_Click_1(object sender, RoutedEventArgs e)
        {
            DataRowView drv = (DataRowView)displayAsmntDetailsLstvw.SelectedItem;
            string asmntID = drv.Row["assessmentID"].ToString();
            string asmntType = drv.Row["assessmentType"].ToString();

            if (asmntType.Equals("Multiple Choice"))
            {
                LearnerMultipleChoice lrnerMCWindow = new LearnerMultipleChoice(this);
                lrnerMCWindow.Content = null;
                mainContent.Children.Add(lrnerMCWindow.mainContent);

                lrnerMCWindow.asmntIDLbl.Content = asmntID;
                Database.FindMcQuIDs_LrnerMC(lrnerMCWindow);
            }

            if (asmntType.Equals("Wordsearch"))
            {
                LearnerWordsearch lrnerWsWindow = new LearnerWordsearch(this);
                lrnerWsWindow.Content = null;
                mainContent.Children.Add(lrnerWsWindow.mainContent);

                lrnerWsWindow.asmntIDLbl.Content = asmntID;
            }     
        }

        private void takeAsmnt_Cancel_Click_1(object sender, RoutedEventArgs e)
        {
            displayAsmntDetailsLstvw.SelectedItem = null; ;
        }
    }
}
